package svc

import (
	"tianji-network/service/gateway/api/internal/config"
	"tianji-network/service/gateway/api/internal/middleware"
	"tianji-network/service/satellite/rpc/satelliteclient"

	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
)

type ServiceContext struct {
	Config       config.Config
	SatelliteRpc satelliteclient.Satellite
	Example      rest.Middleware
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:       c,
		SatelliteRpc: satelliteclient.NewSatellite(zrpc.MustNewClient(c.SatelliteRpc)),
		Example:      middleware.NewExampleMiddleware().Handle,
	}
}
